/**
 *  数据管理 api
 *  @module api/site
 *  @author coder
 */

// API_HOST
import { API_HOST } from '@/config';

// axios
import axios from '@u/axios';

/**
 * 添加数据源
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const addSource = (data) =>
	axios({
		method: 'post',
		data: data,
		url: API_HOST + '/data/source/add'
	});

/**
 * 更新数据源
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const editSource = (data) =>
	axios({
		method: 'put',
		data: data,
		url: API_HOST + '/data/source/edit'
	});

/**
 * 删除数据源
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const removeSource = (data) =>
	axios({
		method: 'delete',
		data: data,
		url: API_HOST + '/data/source/remove'
	});

/**
 * 获取数据源分页列表
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const pageSource = (data) =>
	axios({
		method: 'get',
		data: data,
		url: API_HOST + '/data/source/page'
	});

/**
 * 获取数据源单条信息详情
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const infoSource = (data) =>
	axios({
		method: 'get',
		data: data,
		url: API_HOST + '/data/source/info'
	});

/**
 * 查询数据源列表下拉框
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const listSource = (data) =>
	axios({
		method: 'get',
		data: data,
		url: API_HOST + '/data/source/list'
	});

/**
 * 添加api编排
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const addArrange = (data) =>
	axios({
		method: 'post',
		data: data,
		url: API_HOST + '/data/arrange/add'
	});

/**
 * 更新api编排
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const editArrange = (data) =>
	axios({
		method: 'put',
		data: data,
		url: API_HOST + '/data/arrange/edit'
	});

/**
 * 删除api编排
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const removeArrange = (data) =>
	axios({
		method: 'delete',
		data: data,
		url: API_HOST + '/data/arrange/remove'
	});

/**
 * 获取api编排分页列表
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const pageArrange = (data) =>
	axios({
		method: 'get',
		data: data,
		url: API_HOST + '/data/arrange/page'
	});

/**
 * 获取api编排单条信息详情
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const infoArrange = (data) =>
	axios({
		method: 'get',
		data: data,
		url: API_HOST + '/data/arrange/info'
	});

/**
 * 获取api编排列表
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const listArrange = (data) =>
	axios({
		method: 'get',
		data: data,
		url: API_HOST + '/data/arrange/list'
	});

/**
 * 根据id获取sql执行结果
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const resultArrange = (data) =>
	axios({
		method: 'get',
		data: data,
		url: API_HOST + '/data/arrange/result'
	});

/**
 * 添加api编排
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const addOutApi = (data) =>
	axios({
		method: 'post',
		data: data,
		url: API_HOST + '/outside/api/add'
	});

/**
 * 更新api编排
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const editOutApi = (data) =>
	axios({
		method: 'put',
		data: data,
		url: API_HOST + '/outside/api/edit'
	});

/**
 * 删除api编排
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const removeOutApi = (data) =>
	axios({
		method: 'delete',
		data: data,
		url: API_HOST + '/outside/api/remove'
	});

/**
 * 获取api编排分页列表
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const pageOutApi = (data) =>
	axios({
		method: 'get',
		data: data,
		url: API_HOST + '/outside/api/page'
	});

/**
 * 获取api编排单条信息详情
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const infoOutApi = (data) =>
	axios({
		method: 'get',
		data: data,
		url: API_HOST + '/outside/api/info'
	});

/**
 * 获取api编排列表
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const listOutApi = (data) =>
	axios({
		method: 'get',
		data: data,
		url: API_HOST + '/outside/api/list'
	});

/**
 * 根据id获取sql执行结果
 * @param {object} [data] 发送键值对数据
 * @returns {promise}
 */
export const resultOutApi = (data) =>
	axios({
		method: 'get',
		data: data,
		url: API_HOST + '/outside/api/result'
	});
